
 <script language="javascript">
 changeWaiting(0); 
 var fmfrmreportdetail_smscontent = '' ; 
 $(document).ready(function () {
    initForm('fmfrmreportdetail_tblinfo'); 
    initDivleft();
    $('#fmfrmreportdetail_divsms').dialog({
        autoOpen: false,
        title: 'Gửi sms thông tin chi tiết',
        modal:true,
        width: 600,
        resizable: true,
        overflow: 'auto'
    });    
});
 var fmfrmreportdetail_cal1 = CreateCalObject('fmfrmreportdetail_fromdate', 'fmfrmreportdetail_imgCal1');
var fmfrmreportdetail_cal2 = CreateCalObject('fmfrmreportdetail_todate', 'fmfrmreportdetail_imgCal2');
var fmfrmreportdetail_cal3 = CreateCalObject('fmfrmreportdetail_dateDelete', 'fmfrmreportdetail_imgCal3'); 
 fmfrmreportdetail_cal1.time_comp = true;
 fmfrmreportdetail_cal2.time_comp = true;
 fmfrmreportdetail_cal3.time_comp = false; 
function fmfrmreportdetail_createReport(){
     room = $('#fmfrmreportdetail_cbbroom').val();
     if(!checkDate('fmfrmreportdetail_fromdate','fmfrmreportdetail_todate',7)){
        return false;
     } 
     fromdate = ConvertoDateEN($('#fmfrmreportdetail_fromdate').val());
     todate = ConvertoDateEN($('#fmfrmreportdetail_todate').val());
     reporttype = $('INPUT[NAME=fmfrmreportdetail_reporttype]:checked').val();
     changeWaiting(0);
     xajax_fmfrmreportdetail_load(fromdate,todate,room,reporttype);  
}

$('#fmfrmreportdetail_fromdate').val(GetCurrentDateTime(0,0,true,0)) ;
$('#fmfrmreportdetail_todate').val(GetCurrentDateTime(0,0,true,2)) ;
$('#fmfrmreportdetail_dateDelete').val(GetCurrentDateTime(0,1,false,0)) ;

function fmfrmreportdetail_openDetail(generate_id,timebegin,timeend,roomname){
  $('#fmfrmreportdetail_productDetail').dialog('option', 'title', 'Chi tiết sản phẩm phòng '+roomname+' từ '+ timebegin +' đến' + timeend);   
  xajax_fmfrmreportdetail_productDetail(generate_id);
}
changeWaiting(0);
function fmfrmreportdetail_loadRoom(){
    xajax_fmfrmreportdetail_loadRoom();
}

function fmfrmreportdetail_deleteDetail(){
    var dateDelete = $('#fmfrmreportdetail_dateDelete').val();
    if(!isDate(dateDelete)){
        alert('Vui lòng nhập chính xác ngày xóa thông tin');
        $('#fmfrmreportdetail_dateDelete').focus();
        return false;
    }
    if(confirm('Chắc chắn xóa dữ liệu chi tiết đến trước ngày '+dateDelete+'?')){
      var dateDelete = ConvertoDateEN(dateDelete);
      xajax_fmfrmreportdetail_deleteDetail(dateDelete);  
    }
    
}


function fmfrmreportdetail_smsSend(){ 
//alert(123);  
   if(checkStatusSMS()){
       $('#fmfrmreportdetail_divsms').dialog('open');
   } 
   
} 

function fmfrmreportdetail_confirm(){ 

   var $phonenumber = $('#fmfrmreportdetail_txtphonenumber').val();
      if($phonenumber.length==0){
          alert('Vui lòng nhập số điện thoại cần gửi');
          $('#fmfrmreportdetail_txtphonenumber').focus();
          return;
      } 
   var arrPhone = new Array();
   arrPhone = $phonenumber.split(";");

   flg = true; 
   for(var i = 0;i<arrPhone.length;i++){
     if(!ExpInteger.test(arrPhone[i])){
         flg = false;
         break;
     }  
   }
   if(!flg){
     alert('Vui lòng nhập (các) số điện thoại cho chính xác');
          $('#fmfrmreportdetail_txtphonenumber').focus();
          return;  
   }   
   xajax_fmfrmreportdetail_saveSMS($phonenumber,fmfrmreportdetail_smscontent);   
}

fmfrmreportdetail_loadRoom();
xajax_fmfrmreportdetail_setPhonenumber(); 
 </script>

<body>
<div class="divmain">
<table width="100%" id="fmfrmreportdetail_tblinfo" class="tblInfo">
<tr>
<td valign="top" class="width25">
<div>
<table class="info" id="frmreportdetail_tblcondition">
<tr >
<td >
<div id="fmfrmreportdetail_divleft" class="divleft"> 
<table class="width100" style="background-color:transparent">

<tr>
<td colspan="2">
Xóa thông tin chi tiết đến trước ngày
</td>
</tr>
<tr>
<td >
<input type="text" value="" onblur="formatddmmyyyy(this)" style="width:80px" maxlength="10"  id="fmfrmreportdetail_dateDelete"/>
<a href="javascript:fmfrmreportdetail_cal3.popup();">
<img src="adagps.com/images/cal/cal2.png" id="fmfrmreportdetail_imgCal3"  class="datepicker dpkstart" ></a>
</td>
<td>
<button id="fmfrmreportdetail_btnDelete" onclick="fmfrmreportdetail_deleteDetail()" class="width100">Xóa dữ liệu chi tiết</button>
</td>
</tr>

<tr>
<td colspan="2" style="border-bottom:thin solid #000000;"></td></tr>

<tr><td width="40%">Gửi sms chi tiết:</td><td style="text-align:right">
 <button id="fmfrmreportdetail_smsSend" class="smsSend width100" onclick="fmfrmreportdetail_smsSend();" type="button"> Gửi </button>
</td></tr>
<tr>
<td colspan="2" style="border-bottom:thin solid #000000;"></td></tr>

<!--<tr>
<td colspan="2"><hr></td></tr>-->

<tr><td>Phòng:</td>
<td id='fmfrmreportdetail_tdcbb'>
<select id="fmfrmreportdetail_cbbRoom">
<option value="">Tất cả:</option>
</select>  </td>
</tr>

 
<tr><td>TG kết thúc từ:</td>
<td><input type="text" value="" onblur="formatddmmyyyy(this)" style="width:140px" maxlength="19"  id="fmfrmreportdetail_fromdate"/><a href="javascript:fmfrmreportdetail_cal1.popup();">
<img src="adagps.com/images/cal/cal2.png" id="fmfrmreportdetail_imgCal1"  class="datepicker dpkstart" ></a>
</td></tr>
<tr>
<td>TG kết thúc đến:</td>
<td>
<input type="text"  value="" onblur="formatddmmyyyy(this)"  id="fmfrmreportdetail_todate" style="width:140px" maxlength="19" /><a href="javascript:fmfrmreportdetail_cal2.popup();">
<img src="adagps.com/images/cal/cal2.png" id="fmfrmreportdetail_imgCal2"    class="datepicker dpkend" ></a>  </td>
</tr>
<tr><td rowspan="3">Loại báo cáo:</td><td><input type="radio" checked="checked" name="fmfrmreportdetail_reporttype" id="fmfrmreportdetail_reporttype_1" value="1">
Theo hóa đơn</input> </td></tr>
<tr><td colspan="2"><input type="radio"  name="fmfrmreportdetail_reporttype" id="fmfrmreportdetail_reporttype_2" value="2">Theo phòng</input></td></tr>
<tr><td colspan="2"><input type="radio"  name="fmfrmreportdetail_reporttype" id="fmfrmreportdetail_reporttype_3" value="3">Theo người phục vụ</input></td></tr>


</table>
    <div class="divactionbuton">

        <button id="fmfrmreportdetail_create" class="bntreport" onclick="fmfrmreportdetail_createReport();" type="button"> Xem </button>
        </div>
</div>
</td>
</tr>
<tr>
<td>

</td>
</tr>
</table>
</div>
</td>
<td class="clsmiddle"></td>

<td width="80%" height="400" valign="top">
<div class="divGrid" id="fmfrmreportdetail_divGrid">

</div>

<div  id="fmfrmreportdetail_divsms"  style="width:600px" align="center">
<table><tr>
<td style="text-align:right">(Các) số điện thoại :
</td>
<td><input maxlength="50" title="Danh sách các số điện thoại nhận tin nhắn!" id="fmfrmreportdetail_txtphonenumber" type="text" class="width100"/>
</td>
</tr>
</table>  
<div id="fmfrmreportdetail_divsmscontent"> </div>
</div>

</td>
<td class="clsend"></td>
</tr>
</table>
</div>

</body>

